/**
 * Created by Administrator on 2016/12/30.
 */

function flake() {
    var img = document.createElement('img');
    // 创建标签
    var h = document.body.scrollHeight - 200;
    //获取浏览器的高度
    // alert(h);
    var w = document.body.scrollWidth ;
    // alert(w);
    var left = Math.random()*w;
    var top =  Math.random()*h;
    img.src = '../photos/personnal/flake.png';
    document.body.appendChild(img);
    img.style.position = 'absolute';
    img.style.left = left + 'px';
    img.style.top = top + 'px';
    img.style.transform = 'scale( ' + Math.random() / 2 +')';
    function down(){
        left +=Math.random()*10;
        top += Math.random()*5;
        if(left > w)left = -100;
        if(top>h) top = -100;
        img.style.left = left + 'px';
        img.style.top = top + 'px';
    }
    //down();
    setInterval(down,200);
}
flake();
for(var i =0; i<100;i++){
    new flake();
}